#include "global.h"
#include "s_needshow.h"
#include "ui_s_needshow.h"

s_needShow::s_needShow(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::s_needShow)
{
    ui->setupUi(this);
    querytable();
}

s_needShow::~s_needShow()
{
    delete ui;
}

void s_needShow::querytable(){
    QSqlQuery query;
    QString str=QString("SELECT * FROM dorm2.water_a_repair_h where stu_sid='%1'").arg(global::userid);
//    qDebug()<<str;

    model.setQuery(str);
    ui->tableView->setModel(&model);
    ui->tableView->setColumnHidden(7,true);

    model.setHeaderData(0,Qt::Horizontal,"单号");
    model.setHeaderData(1,Qt::Horizontal,"宿管工号");
    model.setHeaderData(2,Qt::Horizontal,"宿管姓名");
    model.setHeaderData(3,Qt::Horizontal,"学生id");
    model.setHeaderData(4,Qt::Horizontal,"学生姓名");
    model.setHeaderData(5,Qt::Horizontal,"需求");
    model.setHeaderData(6,Qt::Horizontal,"处理状态");
    model.setHeaderData(8,Qt::Horizontal,"宿舍号");

}
